#include "matrixfunctions.h"

void cwspiralPrint(int x[][100], int row, int col)
{
	int i, j, t;
	for(t=0; t<(row/2) + 1; t++){
		for(i=t; i<col-t; i++)
			cout<<x[t][i]<<" ";
		for(j=t+1; j<row-t-1; j++)
			cout<<x[j][col-t-1]<<" ";
		for(i=col-t-1; i>=t; --i)
			cout<<x[row-t-1][i]<<" ";
		for(j=row-t-2; j>t; --j)
			cout<<x[j][t]<<" ";
	
	}
}


int main()
{
	int row, col, k;
	int mat[100][100];
	cout<<"Number of rows : ";
	cin>>row;
	cout<<"Number of columns : ";
	cin>>col;
	readmatrix(mat, row, col);
	printmatrix(mat, row, col);
	cout<<endl;
	cwspiralPrint(mat, row, col);
	cout<<endl;
	
	
return 0;
}
